<form class="layui-form" lay-filter="form" id="form">
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">用户名</label>
        <div class="layui-input-inline">
            <input type="text" name="username" lay-verify="required" lay-reqText="用户名不能为空" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label label-required-next">商户名称</label>
        <div class="layui-input-inline">
            <input type="text" name="title" lay-verify="required" lay-reqText="商户名称不能为空" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="password" name="password" id="password" lay-verify="password" autocomplete="off" class="layui-input" placeholder="不修改请留空">
        </div>
        <label class="layui-form-label">重复密码</label>
        <div class="layui-input-inline">
            <input type="password" name="repeat_password" lay-verify="resspaword" autocomplete="off" class="layui-input" placeholder="不修改请留空">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">logo</label>
        <div class="layui-input-inline">
            <input type="text" name="image" lay-verify="required" lay-reqText="logo不能为空" autocomplete="off" class="layui-input plupload_btn_input">
        </div>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <a href="{{ d.params.image || '' }}" target="_blank">
                    <img src="{{ d.params.image || '' }}" width="35" class="{{ d.params.image || 'layui-hide' }}">
                </a>
            </script>
            <button type="button" class="layui-btn layui-btn-sm plupload_btn" id="image"><i class="layui-icon sm_iconfont icon-yunshangchuan"></i>选择图片</button>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">营业执照</label>
        <div class="layui-input-inline">
            <input type="text" name="business_license" lay-verify="required" lay-reqText="营业执照不能为空" autocomplete="off" class="layui-input plupload_btn_input">
        </div>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <a href="{{ d.params.business_license || '' }}" target="_blank">
                    <img src="{{ d.params.business_license || '' }}" width="35" class="{{ d.params.business_license || 'layui-hide' }}">
                </a>
            </script>
            <button type="button" class="layui-btn layui-btn-sm plupload_btn" id="business_license"><i class="layui-icon sm_iconfont icon-yunshangchuan"></i>选择图片</button>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">是否开发票</label>
        <div class="layui-input-inline">
            <input type="radio" name="invoice" value="0" title="否" checked lay-verify="required">
            <input type="radio" name="invoice" value="1" title="是" lay-verify="required">
        </div>
        <label class="layui-form-label label-required-next">结算手续费</label>
        <div class="layui-input-inline">
            <input type="text" name="pct" autocomplete="off" class="layui-input" lay-verify="number" lay-reqText="结算手续费只能是数字" placeholder="0-100的数字">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话</label>
        <div class="layui-input-inline">
            <input type="text" name="tel" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-inline">
            <input type="text" name="email" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地区</label>
        <div class="layui-input-inline">
            <select name="prov_id" id="prov_id" lay-filter="prov_id">
            </select>
        </div>
        <div class="layui-input-inline">
            <select name="city_id" id="city_id" lay-filter="city_id">
            </select>
        </div>
        <div class="layui-input-inline">
            <select name="area_id" id="area_id" lay-filter="area_id">
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-block">
            <input type="text" name="address" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">描述</label>
        <div class="layui-input-block">
            <textarea name="content" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="hidden" name="id" value="">
            <input type="button" lay-submit lay-filter="form-submit" value="确认" class="layui-btn">
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script type="text/html" template lay-done="layui.data.sendParams(d.params);"></script>
<script src="../../../../layuiadmin/lib/plupload/plupload.full.min.js"></script>
<script src="../../../../layuiadmin/lib/plupload/i18n/zh_CN.js"></script>
<script>
    layui.data.sendParams = function (params) {
        layui.use(['verify', 'plupload'], function () {
            let $ = layui.$,
                form = layui.form,
                plupload = layui.plupload,
                common = layui.common;

            plupload.init();//初始化上传

            //设置默认省市区
            common.set_default_area(params.prov_id, params.city_id, params.area_id);
            //监听省份选择
            form.on('select(prov_id)', function (data) {
                common.get_area('city_id', data.value);
            });
            //监听城市选择
            form.on('select(city_id)', function (data) {
                common.get_area('area_id', data.value);
            });
        });
    };
</script>